System. Diagnostics. Process
Редактировал(а) Alexandr Fokin 2023/05/07 13:08
Process.start: how to get the output?
https://stackoverflow.com/questions/4291912/process-start-how-to-get-the-output
EXECUTE A BASH SCRIPT VIA C#/.NET CORE
https://jackma.com/2019/04/20/execute-a-bash-script-via-c-net-core/
Template | ProcessStartInfo info = new ProcessStartInfo(); // fill info ... info.RedirectStandardOutput = true; info.RedirectStandardError = true; //token.ThrowIfCancellationRequested(); using Process process = Process.Start(info); try { await process.WaitForExitAsync(token); } catch (OperationCanceledException) { process.Kill(true); await process.WaitForExitAsync(); throw; } var outputString = await process.StandardOutput.ReadToEndAsync(); var errorString = await process.StandardError.ReadToEndAsync(); if (process.ExitCode == 0) { //Successe } else { //Error } |
Arguments (args) | Command Line Arguments Parser |